package rpc

import (
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	loginServiceV1 "grpc/user/login"
	"log"
)

// UserGrpcClient 全局变量
var UserGrpcClient loginServiceV1.LoginServiceClient

func InitUserGrpcClient() {
	// 注册grpc resolver 解析器解析 URL
	//etcdRegister := discovery.NewResolver(config.AppConf.Ec.Addrs, logs.LG)
	//resolver.Register(etcdRegister)

	// 连接GRPC端口
	conn, err := grpc.NewClient("127.0.0.1:8881", grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		log.Fatalf("did not connect: %v", err)
	}
	UserGrpcClient = loginServiceV1.NewLoginServiceClient(conn)
}
